<?php
namespace app\admin\model;

use think\Model;

class Article extends Model
{

	protected $insert				= ['image'];

	public function archive()
	{
		//用法：belongsTo('关联模型','外键','关联表主键');
		return $this->belongsTo('Archive');
	}



	//自用方法
	public function setData(array $params)
	{
		return $this->data([
			'content'	=>	$params['content'],
			]);
	}
	static public function staticData(array $params)
	{
		return [
		'content' => $params['content']
		];
	}
	//内置方法
	protected function setContentAttr($value,$data)
	{
		//return $data['archive_id'];
		return '[经过修改器修改内容的]'.$value;
	}
	protected function setImageAttr($data)
	{

		return isset($data)?$data:'default/image.jpg';

	}
}